<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <title>事件处理</title>
</head>
<body>
    <div id="app">
        <!-- 事件处理方法 -->
        <button @click="greet">greet</button>
        <!-- 内联处理器中的方法 -->
         <!-- 事件修饰符 -->
        <button @click.once="say('hi')">say hi</button>
        <button @click="say('what')">say what</button>
        <!-- 按键修饰符 -->
        <input @keyup.enter="submit">
        
    </div>

    <script type="text/javascript">
     var vm=new Vue({
         el:"#app",
         data:{
             name:"vue.js"
         },
         //在methods对象中定义方法
         methods:{
            greet(){
                alert("hello"+this.name)
            },
            say(mes){
                alert(mes)
            },
            submit(){
                alert("按键盘了")
            }

         }
     })

    </script>
    
</body>
</html>